<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
    <title>Sockets test: can be enabled by default permissions policy (self)</title>
    <script src="/resources/testharness.js"></script>
    <script src="/resources/testharnessreport.js"></script>
    <script src="/resources/testdriver.js"></script>
    <script src="/resources/testdriver-vendor.js"></script>
    <script src="resources/direct-sockets-helpers.js"></script>
  </head>
  <body>
    <script>
      'use strict';

      direct_sockets_test(async (t, mockDirectSocketsService) => {
        await test_driver.bless("open socket");
        await promise_rejects_dom(t, "NetworkError", navigator.openTCPSocket({ remotePort: 53 }));
      }, "direct sockets (TCP) do not get blocked on permissions policy direct-sockets=(self)");

      direct_sockets_test(async (t, mockDirectSocketsService) => {
        await test_driver.bless("open socket");
        await promise_rejects_dom(t, "NetworkError", navigator.openUDPSocket({ remotePort: 53 }));
      }, "direct sockets (UDP) do not get blocked by permissions policy on direct-sockets=(self)");
    </script>
  </body>
</html>
